import React, { Component } from 'react'
import { Link } from 'react-router-dom'
import './index.scss'
export default class index extends Component {
  constructor(props) {
    super()
    this.state = {
      // mainlist:{
      //   'src':'https://d.vpimg1.com/upcb/2020/01/09/124/ias_157856363611325_570x273_90.jpg',
      //   'title':'诗篇PSALTER女装专场',
      //   'red_txt':0.3,
      //   'black_txt':1.4
      // }
      mainlist: props.mainlist
    }
  }
  render() {
    const { src, title, text, red_txt } = this.state.mainlist
    return (
      <Link to='/goodslist/HomeData/first'>
        <div className='maindiv'>
          <img className='main_img' src={src} alt='' onMouseEnter={this.changeColor} />
          <h3>{title}</h3>
          <div className='lastDiv'><span>{red_txt}</span>{text}</div>
        </div>
      </Link>
    )
  }
  changeColor=(e)=>{
    var newList = e.target
    e.target.style.opacity=0.5
    setTimeout(()=>{
      newList.style.opacity=1
    },600)}
    componentDidMount(){
      window.scrollTo(0,0)
    }
}
